<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>鑫乐居——行业动态</title>
	<link href="css/bootstrap.min.css" rel="stylesheet">
	<script src="js/jquery.js"></script>
  <script src="js/bootstrap.min.js"></script>
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <link rel="stylesheet" href="css/hangye.css">
	<!--[if it IE 9]>
	<scritp src="html5shiv.js"></script>
	<script src="respond.min.js"></script>
	<![end if]-->
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=5mTWjVwLB6jdCslx6CfeZudBVlQX5KKG"></script>
  <script type="text/javascript">
    window.onload = function () {
      var ckf = document.getElementById('ckf');
      var okf = document.getElementById('okf');
      var kf = document.getElementById('kf');
      var sh = document.getElementById('sh');
      var cl = document.getElementById('cl');
      var mix = document.getElementById('mix');
      var ques = document.getElementById('ques');
      var lyb = document.getElementById('lyb');
      mix.onclick = function () {
        ques.style.display = "block";
        lyb.style.display = "none";
      }
      ques.onclick = function () {
        lyb.style.display = "block";
        ques.style.display = "none";
      }
      ckf.onclick = function () {
        okf.style.display = "block";
        kf.style.display = "none";
      }
      okf.onclick = function () {
        kf.style.display = "block";
        okf.style.display = "none";
      }
      cl.onclick = function () {
        zx.style.display = "none";
        if (zx.style.display = "none") {
          setInterval("zx.style.display = 'block'",5000);
        }
      }
      sh.onclick = function () {
        zx.style.display = "none";
        if (zx.style.display = "none") {
          setInterval("zx.style.display = 'block'",5000);
        }
      }
    }
  </script>
</head>
<body>
		<div id="cont">
			<div id="head">
				<div class="logo"></div>
				<div class="tel">
					<div class="phone"></div>
					<span>400-160-140</span>
				</div>
				<div class="dh">
					<ul>
						<?php
        include "shuju.php";
                    $db = new DB();
                    $sql = "select * from navigation where pid is null";
                    $res = $db->get($sql);
                    for ($i=1; $i <=count($res) ; $i++) {     
                        $fir = $res[$i-1][1];
                        $id = $res[$i-1][0];
                        $href = $res[$i-1][3];
                        echo "<li class='li1'><a href='$href'>$fir</a><ul>";
                        $sql = "select * from navigation where pid = '$id'";
                        $ss = $db->get($sql);
                        for ($j=1; $j <=count($ss) ; $j++) { 
                          $sec = $ss[$j-1][1];
                          $sechr = $ss[$j-1][3];
                          echo "<li><a href='$sechr'>$sec</a></li>";
                        }
                        echo"</ul></li>";
                    }
                  ?>
					</ul>
				</div>
			</div>
			<div id="banner"></div>
      <div id="con">

        <div class="wenzhang" id="wenzhang">
        <?php 
                $db = new DB();
                $sql = "select * from ue where leibie = '行业动态'";
                $res = $db->get($sql);
                for ($i=1; $i <= count($res); $i++) { 
                  $titl = $res[$i-1][1];
                  $id = $res[$i-1][0];
                  $date = date("Y-m-d");
                  echo "<div calss='row$i' style='border-top:solid 1px rgb(230,230,230);height:100px;font-size:17px;width:95%;'><img src='images/hot.jpg''><a style='margin-left:20px;' href='news.php?id=$id'>$titl</a><p style='margin-left:400px;'>$date</p></div>";
                }
             ?>
        </div>
        <div class="list" id="list">
        <?php 
                $db = new DB();
                $sql = "select * from picture where leixing = 'tongyong'";
                $res = $db->get($sql);
                for ($i=1; $i <= count($res); $i++) { 
                  $pic = $res[$i-1][2];
                  echo "<div style='margin-top:10px;'><img src='$pic' /></div>";
                }
             ?>
             <?php 
                $db = new DB();
                $sql = "select * from picture where leixing = 'erweima'";
                $res = $db->get($sql);
                for ($i=1; $i <= count($res); $i++) { 
                  $pic = $res[$i-1][2];
                  echo "<div style='margin-top:10px;'><img src='$pic' /></div>";
                }
             ?>
        </div>
      </div>
      <div id="foot">
        <span>Copyright  2010-2015 All Rights Reserved. 京ICP备15041059号-1 京公网安备11010502027337 北京瑞卓喜创科技发展有限公司版权所有</span>
        <div class="hui"></div>
      </div>
      <script>
          window.onload=function(){
             var odiv=document.getElementById('list');//获取div
             var odiv2=document.getElementById('wenzhang');
             var btn=odiv.getElementsByTagName('li');//获取div下的input
             var div2=odiv2.getElementsByTagName('div') ;//获取div下的div
             // for (i = 1; i < div2.length; i++) {
             //    div2[i].style.display = 'none';
             // }
           
            for(i=0;i<btn.length;i++)//循环每个按钮
             { 
               btn[i].index=i 
          //btn[i]是指定button的第i个按钮;为该按钮添加一个index属性，并将index的值设置为i
               btn[i].onclick=function()//按钮的第i个点击事件
              {
              for(i=0;i<btn.length;i++)//循环去掉button的样式，把div隐藏
               { 
                 btn[i].className='' //清空按钮的样式
                 div2[i].style.display='none'//隐藏div
                }
                  this.className='active'//自身添加active
                  div2[this.index].style.display='block'//this.index是当前div 
              }
             }
          }
          </script>
</body>
</html>